package com.his.service.impl;

import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.his.entity.dto.CheckRequest;
import com.his.entity.dto.MedicalTechnology;
import com.his.entity.po.CheckRequestPO;
import com.his.entity.vo.MedicalTechnologyVO;
import com.his.mapper.CheckMapper;
import com.his.mapper.MedicalTechnologyMapper;
import com.his.service.ICheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CheckServiceImpl implements ICheckService {

    @Autowired
    private CheckMapper checkMapper;
    @Autowired
    private MedicalTechnologyMapper medicalTechnologyMapper;

    /**
     * 查询检查项列表
     * @return
     */
    @Override
    public List<MedicalTechnologyVO> list() {
        List<MedicalTechnologyVO> medicalTechnologies = medicalTechnologyMapper.selectMT();
        return !medicalTechnologies.isEmpty() ? medicalTechnologies : ListUtil.empty();
    }

    /**
     * 提交检查项
     * @param checkRequestPO
     */
    @Override
    public void submit(CheckRequestPO checkRequestPO) {
        checkMapper.insertBatch(checkRequestPO);
    }
}
